//
//  LoginViewController.m
//  悟空市场1.0
//
//  Created by 纵情向前 on 2017/3/16.
//  Copyright © 2017年 纵情向前科技有限公司. All rights reserved.
//

#import "AlertBoxView.h"
#import "AdapterTool.h"
#import "PublicClass.h"
#import "ZFHeader.h"
@interface AlertBoxView ()

@property (nonatomic, strong) UILabel *label;

@end

@implementation AlertBoxView

- (instancetype)init
{
    self = [super init];
    if (self) {
        UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRect:self.bounds];
        
        
        UIView *view = [[UIView alloc] init];
        view.bounds = [AdapterTool getAdapterRectWithRect:CGRectMake(0, 0, 200, 60) isHeight:YES];
        view.center = [AdapterTool getNewPointWithPoint:CGPointMake(375/2,667/2)];
        view.backgroundColor = [UIColor lightGrayColor];
        view.layer.cornerRadius = 10;
//        view.layer.masksToBounds = YES;
        view.layer.borderWidth = 1;
        
        view.layer.masksToBounds = NO;
        view.layer.shadowColor = [UIColor blackColor].CGColor;
        view.layer.shadowOffset = CGSizeMake(0.0f, 5.0f);
        view.layer.shadowOpacity = 0.5f;
        view.layer.shadowPath = shadowPath.CGPath;
        
        self.layer.shadowOpacity = 0.4;//阴影透明度，默认0
        view.layer.borderColor = [UIColor lightGrayColor].CGColor;
        _label = [[UILabel alloc] initWithFrame:[AdapterTool getAdapterRectWithRect:CGRectMake(0, 0, 200, 60) isHeight:YES]];
        _label.textColor = [UIColor blackColor];
        _label.numberOfLines = 0;
        _label.textAlignment = NSTextAlignmentCenter;
        [view addSubview:self.label];
        [self addSubview:view];
        self.alpha = 0;
    }
    return self;
}

- (void)appearAndDisappearAlertWithString:(NSString *)string {
    self.label.text = string;
    self.alpha = 1;
    [UIView animateWithDuration:2 animations:^{
        self.alpha = 0;
    }];
}

@end
